<template>
	<view class="content">
		<image class="title" src="../../static/total_img_banner@2x.png" mode="widthFix"></image>
		<view class="list">
			<museumItem v-for="(item,index) in museumList" :id="item.id" :logo="item.logo" :name="item.name"
				@goTo="goTo(arguments)"></museumItem>
		</view>
	</view>
</template>

<script>
	import museumItem from '../customer/museumItem.vue'
	import {
		hostPage,
		doPostForm
	} from '../../js_sdk/request-helper.js'
	export default {
		components: {
			museumItem
		},
		data() {
			return {
				museumList: []
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			goTo(e) {
				if (typeof e == 'object') {
					if (e[0] == 'index') {
						if (e[1] == 2) {
							uni.showToast({
								title: '敬请期待',
								icon: 'none'
							})
							return
						}
						uni.setStorageSync('museumId', e[1]);
						uni.redirectTo({
							url: "./index"
						})
					}
				}
			},
			getList() {
				doPostForm('/blade-museum/mus/list', {
						pages: 1,
						size: 10,
					},
					(res) => {
						let list = []
						for (let item of res.records) {
							list.push({
								id: item.id,
								logo: item.logoHigh,
								name: '进入'
							})
						}
						this.museumList = list
					}, (err) => {})
			}
		}
	}
</script>

<style>
	.content {
		position: fixed;
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		background-image: linear-gradient(#B9AC90, #8b662f);
	}

	.title {
		width: 100%;
		height: auto;
	}

	.list {
		width: 100;
		height: auto;
		padding: 60rpx 60rpx 0 60rpx;
	}
</style>
